Nico Rieck: Currently _MSC_VER and _WIN32 are used to guard code which is MSVC-specific, MSVCRT-specific, or Windows-specific. Because Clang can also define _MSC_VER, and MSVCRT is not necessarily the only C runtime, these macros should not be used interchangeably. This patch divides all Windows-related bits into the aforementioned categories. Two new macros are introduced: - _LIBCPP_MSVC: Defined when compiling with MSVC. Detected using _MSC_VER, excluding Clang. - _LIBCPP_MSVCRT: Defined when using the Microsoft CRT. This is the default when _WIN32 is defined. This leaves _WIN32 for code using the Windows API. This also corrects the spelling of _LIBCP_HAS_IS_BASE_OF to _LIBCPP_HAS_IS_BASE_OF. Nico, please prepare a patch for CREDITS.TXT, thanks. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@187593 91177308-0d34-0410-b5e6-96231b3b80d8 
diff --git a/include/__config b/include/__config index f003e5b..fa6abf6 100644 --- a/include/__config +++ b/include/__config 
@@ -11,7 +11,7 @@  #ifndef _LIBCPP_CONFIG  #define _LIBCPP_CONFIG   -#ifndef _MSC_VER // explicit macro necessary because it is only defined below in this file +#if !defined(_MSC_VER) || defined(__clang__)  #pragma GCC system_header  #endif   @@ -72,15 +72,20 @@  # define _LIBCPP_LITTLE_ENDIAN 1  # define _LIBCPP_BIG_ENDIAN 0  // Compiler intrinsics (GCC or MSVC) -# if (defined(_MSC_VER) && _MSC_VER >= 1400) \ +# if defined(__clang__) \ + || (defined(_MSC_VER) && _MSC_VER >= 1400) \  || (defined(__GNUC__) && _GNUC_VER > 403) -# define _LIBCP_HAS_IS_BASE_OF +# define _LIBCPP_HAS_IS_BASE_OF  # endif +# if defined(_MSC_VER) && !defined(__clang__) +# define _LIBCPP_MSVC // Using Microsoft Visual C++ compiler +# endif +# define _LIBCPP_MSVCRT // Using Microsoft's C Runtime library  #endif // _WIN32    #ifdef __linux__  # if defined(__GNUC__) && _GNUC_VER >= 403 -# define _LIBCP_HAS_IS_BASE_OF +# define _LIBCPP_HAS_IS_BASE_OF  # endif  #endif   @@ -128,7 +133,7 @@  #endif    #ifndef _LIBCPP_INLINE_VISIBILITY -# ifdef _MSC_VER +# ifdef _LIBCPP_MSVC  # define _LIBCPP_INLINE_VISIBILITY __forceinline  # else // MinGW GCC and Clang  # define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__always_inline__)) @@ -140,7 +145,7 @@  #endif    #ifndef _LIBCPP_ALWAYS_INLINE -# ifdef _MSC_VER +# ifdef _LIBCPP_MSVC  # define _LIBCPP_ALWAYS_INLINE __forceinline  # endif  #endif @@ -273,7 +278,7 @@  #endif    #if __has_feature(is_base_of) -# define _LIBCP_HAS_IS_BASE_OF +# define _LIBCPP_HAS_IS_BASE_OF  #endif    // Objective-C++ features (opt-in) @@ -396,7 +401,7 @@  using namespace _LIBCPP_NAMESPACE __attribute__((__strong__));  }   -#elif defined(_MSC_VER) +#elif defined(_LIBCPP_MSVC)    #define _LIBCPP_HAS_NO_TEMPLATE_ALIASES  #define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER @@ -418,7 +423,7 @@  namespace std {  }   -#endif // __clang__ || __GNUC___ || _MSC_VER +#endif // __clang__ || __GNUC__ || _LIBCPP_MSVC    #ifdef _LIBCPP_HAS_NO_UNICODE_CHARS  typedef unsigned short char16_t; 
diff --git a/include/__locale b/include/__locale index 92f4e0c..93147ec 100644 --- a/include/__locale +++ b/include/__locale 
@@ -19,7 +19,7 @@  #include <cstdint>  #include <cctype>  #include <locale.h> -#ifdef _WIN32 +#ifdef _LIBCPP_MSVCRT  # include <support/win32/locale_win32.h>  #elif (defined(__GLIBC__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__sun__)) || defined(EMSCRIPTEN)  # include <xlocale.h> 
diff --git a/include/algorithm b/include/algorithm index 1403fd6..2fc1f8a 100644 --- a/include/algorithm +++ b/include/algorithm 
@@ -3988,10 +3988,10 @@  _VSTD::sort<_Tp*, _Comp_ref>(__first.base(), __last.base(), __comp);  }   -#ifdef _MSC_VER +#ifdef _LIBCPP_MSVC  #pragma warning( push )  #pragma warning( disable: 4231) -#endif // _MSC_VER +#endif // _LIBCPP_MSVC  _LIBCPP_EXTERN_TEMPLATE(void __sort<__less<char>&, char*>(char*, char*, __less<char>&))  _LIBCPP_EXTERN_TEMPLATE(void __sort<__less<wchar_t>&, wchar_t*>(wchar_t*, wchar_t*, __less<wchar_t>&))  _LIBCPP_EXTERN_TEMPLATE(void __sort<__less<signed char>&, signed char*>(signed char*, signed char*, __less<signed char>&)) @@ -4025,9 +4025,9 @@  _LIBCPP_EXTERN_TEMPLATE(bool __insertion_sort_incomplete<__less<long double>&, long double*>(long double*, long double*, __less<long double>&))    _LIBCPP_EXTERN_TEMPLATE(unsigned __sort5<__less<long double>&, long double*>(long double*, long double*, long double*, long double*, long double*, __less<long double>&)) -#ifdef _MSC_VER +#ifdef _LIBCPP_MSVC  #pragma warning( pop ) -#endif // _MSC_VER +#endif // _LIBCPP_MSVC    // lower_bound   
diff --git a/include/cctype b/include/cctype index e33244e..b647903 100644 --- a/include/cctype +++ b/include/cctype 
@@ -37,9 +37,9 @@    #include <__config>  #include <ctype.h> -#if defined(_MSC_VER) +#if defined(_LIBCPP_MSVCRT)  #include "support/win32/support.h" -#endif // _MSC_VER +#endif // _LIBCPP_MSVCRT    #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)  #pragma GCC system_header 
diff --git a/include/cmath b/include/cmath index bd60344..3e545ce 100644 --- a/include/cmath +++ b/include/cmath 
@@ -301,7 +301,7 @@  #include <math.h>  #include <type_traits>   -#ifdef _MSC_VER +#ifdef _LIBCPP_MSVCRT  #include "support/win32/math_win32.h"  #endif   @@ -673,7 +673,7 @@  using ::acos;  using ::acosf;   -#ifndef _MSC_VER +#ifndef _LIBCPP_MSVCRT  inline _LIBCPP_INLINE_VISIBILITY float acos(float __x) _NOEXCEPT {return acosf(__x);}  inline _LIBCPP_INLINE_VISIBILITY long double acos(long double __x) _NOEXCEPT {return acosl(__x);}  #endif @@ -688,7 +688,7 @@  using ::asin;  using ::asinf;   -#ifndef _MSC_VER +#ifndef _LIBCPP_MSVCRT  inline _LIBCPP_INLINE_VISIBILITY float asin(float __x) _NOEXCEPT {return asinf(__x);}  inline _LIBCPP_INLINE_VISIBILITY long double asin(long double __x) _NOEXCEPT {return asinl(__x);}  #endif @@ -703,7 +703,7 @@  using ::atan;  using ::atanf;   -#ifndef _MSC_VER +#ifndef _LIBCPP_MSVCRT  inline _LIBCPP_INLINE_VISIBILITY float atan(float __x) _NOEXCEPT {return atanf(__x);}  inline _LIBCPP_INLINE_VISIBILITY long double atan(long double __x) _NOEXCEPT {return atanl(__x);}  #endif @@ -718,7 +718,7 @@  using ::atan2;  using ::atan2f;   -#ifndef _MSC_VER +#ifndef _LIBCPP_MSVCRT  inline _LIBCPP_INLINE_VISIBILITY float atan2(float __y, float __x) _NOEXCEPT {return atan2f(__y, __x);}  inline _LIBCPP_INLINE_VISIBILITY long double atan2(long double __y, long double __x) _NOEXCEPT {return atan2l(__y, __x);}  #endif @@ -744,7 +744,7 @@  using ::ceil;  using ::ceilf;   -#ifndef _MSC_VER +#ifndef _LIBCPP_MSVCRT  inline _LIBCPP_INLINE_VISIBILITY float ceil(float __x) _NOEXCEPT {return ceilf(__x);}  inline _LIBCPP_INLINE_VISIBILITY long double ceil(long double __x) _NOEXCEPT {return ceill(__x);}  #endif @@ -759,7 +759,7 @@  using ::cos;  using ::cosf;   -#ifndef _MSC_VER +#ifndef _LIBCPP_MSVCRT  inline _LIBCPP_INLINE_VISIBILITY float cos(float __x) _NOEXCEPT {return cosf(__x);}  inline _LIBCPP_INLINE_VISIBILITY long double cos(long double __x) _NOEXCEPT {return cosl(__x);}  #endif @@ -774,7 +774,7 @@  using ::cosh;  using ::coshf;   -#ifndef _MSC_VER +#ifndef _LIBCPP_MSVCRT  inline _LIBCPP_INLINE_VISIBILITY float cosh(float __x) _NOEXCEPT {return coshf(__x);}  inline _LIBCPP_INLINE_VISIBILITY long double cosh(long double __x) _NOEXCEPT {return coshl(__x);}  #endif @@ -792,7 +792,7 @@    #ifndef __sun__   -#ifndef _MSC_VER +#ifndef _LIBCPP_MSVCRT  inline _LIBCPP_INLINE_VISIBILITY float exp(float __x) _NOEXCEPT {return expf(__x);}  inline _LIBCPP_INLINE_VISIBILITY long double exp(long double __x) _NOEXCEPT {return expl(__x);}  #endif @@ -808,7 +808,7 @@  using ::fabs;  using ::fabsf;   -#ifndef _MSC_VER +#ifndef _LIBCPP_MSVCRT  inline _LIBCPP_INLINE_VISIBILITY float fabs(float __x) _NOEXCEPT {return fabsf(__x);}  inline _LIBCPP_INLINE_VISIBILITY long double fabs(long double __x) _NOEXCEPT {return fabsl(__x);}  #endif @@ -823,7 +823,7 @@  using ::floor;  using ::floorf;   -#ifndef _MSC_VER +#ifndef _LIBCPP_MSVCRT  inline _LIBCPP_INLINE_VISIBILITY float floor(float __x) _NOEXCEPT {return floorf(__x);}  inline _LIBCPP_INLINE_VISIBILITY long double floor(long double __x) _NOEXCEPT {return floorl(__x);}  #endif @@ -840,7 +840,7 @@  using ::fmodf;  #ifndef __sun__   -#ifndef _MSC_VER +#ifndef _LIBCPP_MSVCRT  inline _LIBCPP_INLINE_VISIBILITY float fmod(float __x, float __y) _NOEXCEPT {return fmodf(__x, __y);}  inline _LIBCPP_INLINE_VISIBILITY long double fmod(long double __x, long double __y) _NOEXCEPT {return fmodl(__x, __y);}  #endif @@ -867,7 +867,7 @@  using ::frexp;  using ::frexpf;   -#ifndef _MSC_VER +#ifndef _LIBCPP_MSVCRT  inline _LIBCPP_INLINE_VISIBILITY float frexp(float __x, int* __e) _NOEXCEPT {return frexpf(__x, __e);}  inline _LIBCPP_INLINE_VISIBILITY long double frexp(long double __x, int* __e) _NOEXCEPT {return frexpl(__x, __e);}  #endif @@ -882,7 +882,7 @@  using ::ldexp;  using ::ldexpf;   -#ifndef _MSC_VER +#ifndef _LIBCPP_MSVCRT  inline _LIBCPP_INLINE_VISIBILITY float ldexp(float __x, int __e) _NOEXCEPT {return ldexpf(__x, __e);}  inline _LIBCPP_INLINE_VISIBILITY long double ldexp(long double __x, int __e) _NOEXCEPT {return ldexpl(__x, __e);}  #endif @@ -899,7 +899,7 @@  using ::logf;  #ifndef __sun__   -#ifndef _MSC_VER +#ifndef _LIBCPP_MSVCRT  inline _LIBCPP_INLINE_VISIBILITY float log(float __x) _NOEXCEPT {return logf(__x);}  inline _LIBCPP_INLINE_VISIBILITY long double log(long double __x) _NOEXCEPT {return logl(__x);}  #endif @@ -915,7 +915,7 @@  using ::log10;  using ::log10f;   -#ifndef _MSC_VER +#ifndef _LIBCPP_MSVCRT  inline _LIBCPP_INLINE_VISIBILITY float log10(float __x) _NOEXCEPT {return log10f(__x);}  inline _LIBCPP_INLINE_VISIBILITY long double log10(long double __x) _NOEXCEPT {return log10l(__x);}  #endif @@ -930,7 +930,7 @@  using ::modf;  using ::modff;   -#ifndef _MSC_VER +#ifndef _LIBCPP_MSVCRT  inline _LIBCPP_INLINE_VISIBILITY float modf(float __x, float* __y) _NOEXCEPT {return modff(__x, __y);}  inline _LIBCPP_INLINE_VISIBILITY long double modf(long double __x, long double* __y) _NOEXCEPT {return modfl(__x, __y);}  #endif @@ -943,7 +943,7 @@    #ifndef __sun__   -#ifndef _MSC_VER +#ifndef _LIBCPP_MSVCRT  inline _LIBCPP_INLINE_VISIBILITY float pow(float __x, float __y) _NOEXCEPT {return powf(__x, __y);}  inline _LIBCPP_INLINE_VISIBILITY long double pow(long double __x, long double __y) _NOEXCEPT {return powl(__x, __y);}  #endif @@ -970,7 +970,7 @@  using ::sin;  using ::sinf;   -#ifndef _MSC_VER +#ifndef _LIBCPP_MSVCRT  inline _LIBCPP_INLINE_VISIBILITY float sin(float __x) _NOEXCEPT {return sinf(__x);}  inline _LIBCPP_INLINE_VISIBILITY long double sin(long double __x) _NOEXCEPT {return sinl(__x);}  #endif @@ -985,7 +985,7 @@  using ::sinh;  using ::sinhf;   -#ifndef _MSC_VER +#ifndef _LIBCPP_MSVCRT  inline _LIBCPP_INLINE_VISIBILITY float sinh(float __x) _NOEXCEPT {return sinhf(__x);}  inline _LIBCPP_INLINE_VISIBILITY long double sinh(long double __x) _NOEXCEPT {return sinhl(__x);}  #endif @@ -1002,7 +1002,7 @@  using ::sqrtf;     -#if !(defined(_MSC_VER) || defined(__sun__)) +#if !(defined(_LIBCPP_MSVCRT) || defined(__sun__))  inline _LIBCPP_INLINE_VISIBILITY float sqrt(float __x) _NOEXCEPT {return sqrtf(__x);}  inline _LIBCPP_INLINE_VISIBILITY long double sqrt(long double __x) _NOEXCEPT {return sqrtl(__x);}  #endif @@ -1018,7 +1018,7 @@  using ::tanf;  #ifndef __sun__   -#ifndef _MSC_VER +#ifndef _LIBCPP_MSVCRT  inline _LIBCPP_INLINE_VISIBILITY float tan(float __x) _NOEXCEPT {return tanf(__x);}  inline _LIBCPP_INLINE_VISIBILITY long double tan(long double __x) _NOEXCEPT {return tanl(__x);}  #endif @@ -1033,7 +1033,7 @@  using ::tanh;  using ::tanhf;   -#ifndef _MSC_VER +#ifndef _LIBCPP_MSVCRT  inline _LIBCPP_INLINE_VISIBILITY float tanh(float __x) _NOEXCEPT {return tanhf(__x);}  inline _LIBCPP_INLINE_VISIBILITY long double tanh(long double __x) _NOEXCEPT {return tanhl(__x);}  #endif @@ -1045,7 +1045,7 @@    // acosh   -#ifndef _MSC_VER +#ifndef _LIBCPP_MSVCRT  using ::acosh;  using ::acoshf;   @@ -1060,7 +1060,7 @@    // asinh   -#ifndef _MSC_VER +#ifndef _LIBCPP_MSVCRT  using ::asinh;  using ::asinhf;   @@ -1075,7 +1075,7 @@    // atanh   -#ifndef _MSC_VER +#ifndef _LIBCPP_MSVCRT  using ::atanh;  using ::atanhf;   @@ -1090,7 +1090,7 @@    // cbrt   -#ifndef _MSC_VER +#ifndef _LIBCPP_MSVCRT  using ::cbrt;  using ::cbrtf;   @@ -1127,7 +1127,7 @@  return copysign((__result_type)__x, (__result_type)__y);  }   -#ifndef _MSC_VER +#ifndef _LIBCPP_MSVCRT    // erf   @@ -1426,13 +1426,18 @@  typename enable_if<is_integral<_A1>::value, long>::type  lround(_A1 __x) _NOEXCEPT {return lround((double)__x);}   -// nan -#endif // _MSC_VER +#endif // _LIBCPP_MSVCRT  #endif // __sun__ + +// nan + +#ifndef _LIBCPP_MSVCRT  using ::nan;  using ::nanf; +#endif // _LIBCPP_MSVCRT +  #ifndef __sun__ -#ifndef _MSC_VER +#ifndef _LIBCPP_MSVCRT    // nearbyint   @@ -1610,7 +1615,7 @@  typename enable_if<is_integral<_A1>::value, double>::type  trunc(_A1 __x) _NOEXCEPT {return trunc((double)__x);}   -#endif // !_MSC_VER +#endif // !_LIBCPP_MSVCRT    using ::acosl;  using ::asinl; @@ -1633,15 +1638,15 @@  using ::sinhl;  using ::sqrtl;  using ::tanl; -#ifndef _MSC_VER +#ifndef _LIBCPP_MSVCRT  using ::tanhl;  using ::acoshl;  using ::asinhl;  using ::atanhl;  using ::cbrtl; -#endif // !_MSC_VER +#endif // !_LIBCPP_MSVCRT  using ::copysignl; -#ifndef _MSC_VER +#ifndef _LIBCPP_MSVCRT  using ::erfl;  using ::erfcl;  using ::exp2l; @@ -1672,7 +1677,7 @@  using ::scalbnl;  using ::tgammal;  using ::truncl; -#endif // !_MSC_VER +#endif // !_LIBCPP_MSVCRT    #else   using ::lgamma; 
diff --git a/include/cstdio b/include/cstdio index 718d2f7..1cde3ee 100644 --- a/include/cstdio +++ b/include/cstdio 
@@ -138,12 +138,12 @@  using ::snprintf;  using ::sprintf;  using ::sscanf; -#ifndef _MSC_VER +#ifndef _LIBCPP_MSVCRT  using ::vfprintf;  using ::vfscanf;  using ::vscanf;  using ::vsscanf; -#endif // _MSC_VER +#endif // _LIBCPP_MSVCRT  using ::vprintf;  using ::vsnprintf;  using ::vsprintf; 
diff --git a/include/cstdlib b/include/cstdlib index 95e3842..0a96fb0 100644 --- a/include/cstdlib +++ b/include/cstdlib 
@@ -84,9 +84,9 @@    #include <__config>  #include <stdlib.h> -#ifdef _MSC_VER +#ifdef _LIBCPP_MSVCRT  #include "support/win32/locale_win32.h" -#endif // _MSC_VER +#endif // _LIBCPP_MSVCRT    #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)  #pragma GCC system_header @@ -154,8 +154,8 @@  using ::aligned_alloc;  #endif   -// MSVC already has the correct prototype in <stdlib.h.h> #ifdef __cplusplus -#if !defined(_MSC_VER) && !defined(__sun__) +// MSVCRT already has the correct prototype in <stdlib.h> #ifdef __cplusplus +#if !defined(_LIBCPP_MSVCRT) && !defined(__sun__)  inline _LIBCPP_INLINE_VISIBILITY long abs( long __x) _NOEXCEPT {return labs(__x);}  #ifndef _LIBCPP_HAS_NO_LONG_LONG  inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) _NOEXCEPT {return llabs(__x);} @@ -165,7 +165,7 @@  #ifndef _LIBCPP_HAS_NO_LONG_LONG  inline _LIBCPP_INLINE_VISIBILITY lldiv_t div(long long __x, long long __y) _NOEXCEPT {return lldiv(__x, __y);}  #endif // _LIBCPP_HAS_NO_LONG_LONG -#endif // _MSC_VER +#endif // _LIBCPP_MSVCRT    _LIBCPP_END_NAMESPACE_STD   
diff --git a/include/cstring b/include/cstring index 45075b3..21c9155 100644 --- a/include/cstring +++ b/include/cstring 
@@ -93,8 +93,8 @@    using ::strstr;   -// MSVC, GNU libc and its derivates already have the correct prototype in <string.h> #ifdef __cplusplus -#if !defined(__GLIBC__) && !defined(_MSC_VER) && !defined(__sun__) && !defined(_STRING_H_CPLUSPLUS_98_CONFORMANCE_) +// MSVCRT, GNU libc and its derivates already have the correct prototype in <string.h> #ifdef __cplusplus +#if !defined(__GLIBC__) && !defined(_LIBCPP_MSVCRT) && !defined(__sun__) && !defined(_STRING_H_CPLUSPLUS_98_CONFORMANCE_)  inline _LIBCPP_INLINE_VISIBILITY char* strchr( char* __s, int __c) {return ::strchr(__s, __c);}  inline _LIBCPP_INLINE_VISIBILITY char* strpbrk( char* __s1, const char* __s2) {return ::strpbrk(__s1, __s2);}  inline _LIBCPP_INLINE_VISIBILITY char* strrchr( char* __s, int __c) {return ::strrchr(__s, __c);} 
diff --git a/include/cwchar b/include/cwchar index 845ccec..90eae75 100644 --- a/include/cwchar +++ b/include/cwchar 
@@ -106,9 +106,9 @@  #include <__config>  #include <cwctype>  #include <wchar.h> -#ifdef _WIN32 +#ifdef _LIBCPP_MSVCRT  #include <support/win32/support.h> // pull in *swprintf defines -#endif // _WIN32 +#endif // _LIBCPP_MSVCRT    #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)  #pragma GCC system_header @@ -127,12 +127,12 @@  using ::vfwprintf;  using ::vswprintf;  using ::vwprintf; -#ifndef _MSC_VER +#ifndef _LIBCPP_MSVCRT  using ::swscanf;  using ::vfwscanf;  using ::vswscanf;  using ::vwscanf; -#endif // _MSC_VER +#endif // _LIBCPP_MSVCRT  using ::wprintf;  using ::wscanf;  using ::fgetwc; @@ -146,10 +146,10 @@  using ::putwchar;  using ::ungetwc;  using ::wcstod; -#ifndef _MSC_VER +#ifndef _LIBCPP_MSVCRT  using ::wcstof;  using ::wcstold; -#endif // _MSC_VER +#endif // _LIBCPP_MSVCRT  using ::wcstol;  #ifndef _LIBCPP_HAS_NO_LONG_LONG  using ::wcstoll; 
diff --git a/include/limits b/include/limits index 9b9d7a6..c995ef5 100644 --- a/include/limits +++ b/include/limits 
@@ -111,9 +111,9 @@    #include <__undef_min_max>   -#if defined(_MSC_VER) +#if defined(_LIBCPP_MSVCRT)  #include "support/win32/limits_win32.h" -#endif // _MSC_VER +#endif // _LIBCPP_MSVCRT    _LIBCPP_BEGIN_NAMESPACE_STD   
diff --git a/include/locale b/include/locale index ef7603d..00a275f 100644 --- a/include/locale +++ b/include/locale 
@@ -186,11 +186,11 @@  #endif  #include <cstdlib>  #include <ctime> -#ifdef _WIN32 +#ifdef _LIBCPP_MSVCRT  #include <support/win32/locale_win32.h> -#else // _WIN32 +#else // _LIBCPP_MSVCRT  #include <nl_types.h> -#endif // !_WIN32 +#endif // !_LIBCPP_MSVCRT    #ifdef __APPLE__  #include <Availability.h> 
diff --git a/include/string b/include/string index 88d32b1..283be3a 100644 --- a/include/string +++ b/include/string 
@@ -1032,14 +1032,14 @@  #endif  }   -#ifdef _MSC_VER +#ifdef _LIBCPP_MSVC  #pragma warning( push )  #pragma warning( disable: 4231 ) -#endif // _MSC_VER +#endif // _LIBCPP_MSVC  _LIBCPP_EXTERN_TEMPLATE(class __basic_string_common<true>) -#ifdef _MSC_VER +#ifdef _LIBCPP_MSVC  #pragma warning( pop ) -#endif // _MSC_VER +#endif // _LIBCPP_MSVC    #ifdef _LIBCPP_ALTERNATE_STRING_LAYOUT   
diff --git a/include/support/win32/limits_win32.h b/include/support/win32/limits_win32.h index 671631d..52229c4 100644 --- a/include/support/win32/limits_win32.h +++ b/include/support/win32/limits_win32.h 
@@ -11,8 +11,8 @@  #ifndef _LIBCPP_SUPPORT_WIN32_LIMITS_WIN32_H  #define _LIBCPP_SUPPORT_WIN32_LIMITS_WIN32_H   -#if !defined(_MSC_VER) -#error "This header is MSVC specific, Clang and GCC should not include it" +#if !defined(_LIBCPP_MSVCRT) +#error "This header complements Microsoft's C Runtime library, and should not be included otherwise."  #else    #ifndef NOMINMAX @@ -74,6 +74,6 @@  #define __builtin_nansf(__dummy) _FSnan._Float  #define __builtin_nansl(__dummy) _LSnan._Long_double   -#endif // _MSC_VER +#endif // _LIBCPP_MSVCRT    #endif // _LIBCPP_SUPPORT_WIN32_LIMITS_WIN32_H 
diff --git a/include/support/win32/math_win32.h b/include/support/win32/math_win32.h index 41c50d6..22400c0 100644 --- a/include/support/win32/math_win32.h +++ b/include/support/win32/math_win32.h 
@@ -11,8 +11,8 @@  #ifndef _LIBCPP_SUPPORT_WIN32_MATH_WIN32_H  #define _LIBCPP_SUPPORT_WIN32_MATH_WIN32_H   -#if !defined(_MSC_VER) -#error "This header is MSVC specific, Clang and GCC should not include it" +#if !defined(_LIBCPP_MSVCRT) +#error "This header complements Microsoft's C Runtime library, and should not be included otherwise."  #else    #include <math.h> @@ -108,6 +108,6 @@  return _fpclass(num);  }   -#endif // _MSC_VER +#endif // _LIBCPP_MSVCRT    #endif // _LIBCPP_SUPPORT_WIN32_MATH_WIN32_H 
diff --git a/include/support/win32/support.h b/include/support/win32/support.h index 81cb13a..17abb91 100644 --- a/include/support/win32/support.h +++ b/include/support/win32/support.h 
@@ -30,7 +30,7 @@  size_t nwc, size_t len, mbstate_t *__restrict ps );  }   -#if defined(_MSC_VER) +#if defined(_LIBCPP_MSVCRT)  #define snprintf _snprintf  #include <xlocinfo.h>  #define atoll _atoi64 @@ -109,6 +109,6 @@  return static_cast<int>(r);  }  #endif // !__clang__ -#endif // _MSC_VER +#endif // _LIBCPP_MSVCRT    #endif // _LIBCPP_SUPPORT_WIN32_SUPPORT_H 
diff --git a/include/type_traits b/include/type_traits index 3d3ae5e..99e34d1 100644 --- a/include/type_traits +++ b/include/type_traits 
@@ -730,7 +730,7 @@    // is_base_of   -#ifdef _LIBCP_HAS_IS_BASE_OF +#ifdef _LIBCPP_HAS_IS_BASE_OF    template <class _Bp, class _Dp>  struct _LIBCPP_TYPE_VIS is_base_of @@ -1078,9 +1078,9 @@  _CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x1000);  _CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x2000);  // MSDN says that MSVC does not support alignment beyond 8192 (=0x2000) -#if !defined(_MSC_VER) +#if !defined(_LIBCPP_MSVC)  _CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x4000); -#endif // !_MSC_VER +#endif // !_LIBCPP_MSVC    #undef _CREATE_ALIGNED_STORAGE_SPECIALIZATION   
diff --git a/include/vector b/include/vector index 046d92d..373e7c1 100644 --- a/include/vector +++ b/include/vector 
@@ -309,14 +309,14 @@  #endif  }   -#ifdef _MSC_VER +#ifdef _LIBCPP_MSVC  #pragma warning( push )  #pragma warning( disable: 4231 ) -#endif // _MSC_VER +#endif // _LIBCPP_MSVC  _LIBCPP_EXTERN_TEMPLATE(class __vector_base_common<true>) -#ifdef _MSC_VER +#ifdef _LIBCPP_MSVC  #pragma warning( pop ) -#endif // _MSC_VER +#endif // _LIBCPP_MSVC    template <class _Tp, class _Allocator>  class __vector_base